diff --git a/sympy/combinatorics/perm_groups.py b/sympy/combinatorics/perm_groups.py
index de94ddabb4..0f3a7069eb 100644
--- a/sympy/combinatorics/perm_groups.py
+++ b/sympy/combinatorics/perm_groups.py
@@ -2192,20 +2192,22 @@ def _number_blocks(blocks):
                 # a representative block (containing 0)
                 rep = {j for j in range(self.degree) if num_block[j] == 0}
                 # check if the system is minimal with
-                # respect to the already discovere ones
+                # respect to the already discovered ones
                 minimal = True
                 to_remove = []
                 for i, r in enumerate(rep_blocks):
                     if len(r) > len(rep) and rep.issubset(r):
                         # i-th block system is not minimal
-                        del num_blocks[i], blocks[i]
-                        to_remove.append(rep_blocks[i])
+                        to_remove.append(i)
                     elif len(r) < len(rep) and r.issubset(rep):
                         # the system being checked is not minimal
                         minimal = False
                         break
                 # remove non-minimal representative blocks
-                rep_blocks = [r for r in rep_blocks if r not in to_remove]
+                for i in sorted(to_remove, reverse=True):
+                    del num_blocks[i]
+                    del blocks[i]
+                rep_blocks = [r for i, r in enumerate(rep_blocks) if i not in to_remove]
 
                 if minimal and num_block not in num_blocks:
                     blocks.append(block)
